package api

import (
	"CodeCover/internal/db"
	"CodeCover/internal/handler"
	"CodeCover/internal/respository"
	"CodeCover/internal/service"

	"github.com/gin-gonic/gin"
)

func RegisterRoute(r *gin.Engine) {

	userRepo := respository.NewMysqlUserRepository(db.SqlDB)
	userService := service.NewUserService(userRepo)
	userHandler := handler.NewUserHandler(userService)

	r.POST("/register", userHandler.Register)
}

func LoginRoute(r *gin.Engine) {
	userRepo := respository.NewMysqlUserRepository(db.SqlDB)
	userService := service.NewUserService(userRepo)
	userHandler := handler.NewUserHandler(userService)

	r.POST("/login", userHandler.Login)
	r.POST("/logout", userHandler.LoginOut)
}
